"""
创建有数据的集合
创建空集合

集合无序
集合自动去重
集合自动拆分字符串
空集合只能用set()创建
"""
s1 = {10, 20, 30, 40, 50}
print(s1)

s2 = {10, 30, 20, 30, 20}
print(s2)

s3 = set('abcdef')
print(s3)

s4 = set()
print(type(s4))
s5 = {}
print(type(s5))


"""
集合增加数据
add()
update()
"""
s1 = {10, 20}
print(s1)
s1.add(100)
print(s1)
s1.add(100)
print(s1)
# s1.add([1, 2, 3])  # 报错
s1.update([10, 20, 30, 40, 50])
print(s1)

"""
remove()
discard()
pop()随机删除
"""
s1.remove(10)
print(s1)
# s1.remove(10) # 报错
s1.discard(10)
print(s1)

del_num = s1.pop()
print(del_num)
print(s1)

"""
in
not in
"""

s1 = {10, 20, 30, 40, 50}
print(10 in s1)
print(10 not in s1)